<template>
  <div class="kh-side-nav">
    <a class="kh-to-logo" href="javascript:;"></a>
    <ul>
      <li v-for="(item,index) in menu" :key="index">
        <router-link :to="{path: item.path}">{{item.title}}</router-link>
      </li>
    </ul>
  </div>
</template>

<script>
  export default {
    name: "left-nav",
    data(){
      return {
        menu: [
          {
            path: 'home',
            title: 'Home'
          },
          {
            path: 'case',
            title: 'Case'
          },
          {
            path: 'article',
            title: 'Article'
          },
          {
            path: 'practice',
            title: 'Practice'
          },
          {
            path: 'about',
            title: 'About'
          }
        ],
        thisIndex: 0,
        hashVal: window.location.hash.substring(2) // 获取当前页面的名字
      }
    },
    computed: {
    },
    methods: {

    },
    mounted(){

    },
  }
</script>

<style lang="scss" scoped>
  .kh-side-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 160px;
    height: 100%;
    text-align: center;
    border-right: 1px solid #000;

    .kh-to-logo {
      display: block;
      width: 52px;
      height: 70px;
      margin: 50px auto 120px;
      background-image: url("../../../static/blog/to-logo.png");
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
    }

    ul {
      a {
        font-size: 18px;
        color: #999;
        display: inline-block;
        margin-bottom: 50px;
        position: relative;

        &:hover {
          color: #000;

          &:after {
            opacity: 1;
            bottom: -10px;
            background-color: #000;
          }
        }

        &:after {
          opacity: 0;
          content: '';
          position: absolute;
          bottom: 0;
          left: 50%;
          width: 20px;
          height: 4px;
          border-radius: 2px;
          background-color: #999;
          transform: translate(-50%, 0);
          transition: all 0.3s;
        }
      }
    }

    .kh-side-nav-actv {
      color: #000;

      &:after {
        opacity: 1;
        bottom: -10px;
        background-color: #000;
      }
    }
  }
</style>
